package com.itheima.d1_static_field;

public class Test {
    public static void main(String[] args) {
        //目标：理解static关键字
        //理解static修饰的成员变量的用法
        //格式：类名.静态变量(推荐的方式)
        Student.name = "袁华";
        System.out.println(Student.name);

        //对象.静态变量(不推荐)
        Student s1 = new Student();
        s1.name = "马冬梅";
        System.out.println(Student.name);

        //对象.静态变量(不推荐)
        Student s2 = new Student();
        s1.name = "秋雅";
        System.out.println(Student.name);



        //2.对象，实例变量(只能用对象去访问)
       // Student.age = 18;报错
        s1.age = 23;
        s2.age = 18;
        System.out.println(s1.age);
        System.out.println(s2.age);
    }
}
